package cn.lisens.jpa.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lisens.jpa.domain.User;
import cn.lisens.jpa.repository.UserRepository;

@Service
public class UserService {

	@Autowired
	private UserRepository userRepository;
	
	public User save(User user) {
		User u = userRepository.save(user);
		System.err.println(user);
		System.err.println(u);
		return u;
	}
	
	public List<User> findList(User user) {
		return userRepository.findByUsername(user.getUsername());
	}
}
